package com.yanqu.road.server.cmd.estatewar.activity.cross;

import com.yanqu.road.pb.estatewar.EstateWarProto;
import com.yanqu.road.server.cmd.base.AbstractServerCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manger.palace.PalaceActivity;
import com.yanqu.road.server.manger.palace.PalaceActivityMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;


@Cmd(code = Protocol.S_PALACE_CROSS_BATTLE_RECORD_NOTIFY, desc = "跨服来访记录通知")
public class CrossPalaceBattleRecordNotifyCmd extends AbstractServerCommand {

	private EstateWarProto.PalaceBattleRecordNotifyMsg reqMsg;

	@Override
	public boolean parseData(YanQuMessage packet) throws Exception {
		reqMsg = EstateWarProto.PalaceBattleRecordNotifyMsg.parseFrom(packet.getBytes());
		return true;
	}

	@Override
	public void execute(YanQuMessage packet) throws Exception {
		PalaceActivity palaceActivity = PalaceActivityMgr.getPalaceActivity(reqMsg.getActivityId());
		if(null != palaceActivity){
			palaceActivity.addBattleRecord(reqMsg);
		}
	}

	@Override
	public void sendData(YanQuMessage packet) throws Exception {

	}

}
